import app from './app'
import { accessToken } from '@/configs/useCurrentUser';

const maxTimeout = app.isDevelopment() ? 99999999 : 6000;
const axios = {
	async post (url, data) {
		let promise = new Promise((resolve, reject) => {
			uni.request({
				url: `${app.web.domain}${url}`,
				data: data,
				method: "POST",
				header: {
					[accessToken.requestKey]: accessToken.token
				},
				success (res) {
					resolve(res.data);
				},
				fail (err) {
					reject(err);
				}
			});
		});
		return promise;
	}
};

export default axios;